package com.it.boot.config.excel;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.format.NumberFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;

@Data
@HeadRowHeight(20)  // 表头行高
@ContentRowHeight(15) // 内容行高
public class UserExportVO {

    @ExcelProperty("用户ID")
    private Long id;

    @ExcelProperty("用户名")
    @ColumnWidth(20)
    private String username;

    @ExcelProperty("手机号")
    @ColumnWidth(20)
    private String phone;

    @ExcelProperty("邮箱")
    @ColumnWidth(25)
    private String email;

    @ExcelProperty("头像")
    @ColumnWidth(30)
    private String avatar;

    // 简单日期格式化
    @ExcelProperty(value = "创建时间", format = "yyyy-MM-dd") // , converter = DateConverter.class
    @DateTimeFormat("yyyy年MM月dd日 HH时mm分ss秒")
    private LocalDateTime createTime;

    @ExcelProperty("千分位格式")
    @NumberFormat("#,##0.00") // 设置千分位格式
    private Double amount;

    @ExcelProperty("测试百分比")
    @ColumnWidth(30)
    @NumberFormat("#.###%")
    private BigDecimal process;

    // 简单日期格式化
    @ExcelProperty(value = "Date时间") // , converter = DateConverter.class
    @DateTimeFormat("yyyy年MM月dd日")
    private Date date;
}